﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IceDog.Lib.ExtensionMethod.ExtensionString1
{
    public static class WordProcessor
    {
        public static List<string> GetWords(this string sentence, bool cpaitalizeWords = false, bool reverseOrder = false, bool reverseWords = false)
        {
            return sentence.Split(' ').ToList<string>();
        }

        public static string ToStringReversed(this object inputObject)
        {
            var str = inputObject as string;
            return "reverse:"+str;
        }
        public static string AsSentence(this List<string> words)
        {
            var sb = new StringBuilder();
            for (int i = 0; i < words.Count; i++)
            {
                sb.Append(words[i]);
                if (i != words.Count - 1)
                {
                    sb.Append(' ');
                }
            }
            return sb.ToString();
        }
        public static U GetFirstObj<U>(this List<U> list)
        {
            return list.FirstOrDefault();
        }

        public static Type GetSelfType<U>(this U list)
        {
            return list.GetType();
        }
    }
}
